package com.qfedu.knowledge.util;

import java.util.List;
import java.util.Objects;

/**
 * @ClassName StringUtils
 * @Author ykx
 * @Date 2024/1/22 22:36
 * @Version 1.0
 */
public class StringUtils {

    /**
     * 字符串集合拼接成字符串
     *
     * @param list  集合
     * @param split 分隔符
     * @return String
     */
    public static String ListToString(List<String> list, String split) {
        StringBuilder stringBuilder = new StringBuilder();
        if (Objects.isNull(list) || list.isEmpty()) {
            return null;
        }
        for (String s : list) {
            stringBuilder.append(s).append(split);
        }
        return stringBuilder.toString();
    }

}
